<template>
  <van-overlay :show.sync="show" @click="hideOverlay">
    <div class="video-container">
      <video v-if="phoneLoginEnabled" @click.stop.native="" :src="url" controls></video>
      <div style="color: white" v-if="!phoneLoginEnabled">暂不支持手机端播放</div>
    </div>
  </van-overlay>
</template>

<script>
import { getConfigList } from "../common/api/question";

export default {
  props: {
    url: String,
    show: Boolean,
  },
  data(){
    return {
      phoneLoginEnabled: false
    }
  },
  onReady() {
    console.log(1111)
    this.getPhoneLoginEnabled()
  },
  methods: {
    async getPhoneLoginEnabled(){
      let params={
        pageNum:1,
        pageSize:10,
        configKey:'sys.video.open'
      }
      let res = await getConfigList(params)
      this.phoneLoginEnabled = res.rows[0].configValue=='false'?false:true
    },
    hideOverlay() {
      this.$emit("update:show", false);
    },
  },
};
</script>
<style>
.video-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.video-container video {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
}
</style>
